{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 一　背景介绍"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " - **相:** 系统中物理性质及化学性质均匀的部分。相，可由纯物质组成也可由混合物和溶体组成，可以是气、液、固等不同形式的聚集态，相与相之间有分界面存在.\n",
    "\n",
    "\n",
    "- **相变:** 某些物质在一定气压下具有熔点，高于熔点，固体就会成为液体;同时还有气化点，超过这个温度，物质就处于气态.这称为相变．\n",
    "\n",
    "\n",
    "- **熔点:(melting point):** 是指所有物质由固体(solid)转化成液态(liquid)的温度.\n",
    "\n",
    "\n",
    "- **潜热(latent heat):** 是物质在物态变化（相变）过程中，在温度没有变化的情况下，吸收或释放的能量. 包含记为 $L$．\n",
    "\n",
    "\n",
    "- **界面:** 相与相之间的交界面。即两相间的接触表面。有固-固、液-液、固-气、固-液和液-气这些类型．记为　$\\Gamma = \\partial\\Omega^-$．\n",
    "\n",
    "\n",
    "- **Stefan 问题:**　 固体和液体之间的界面用$\\Gamma(t)$表示，固体凝固或溶解时，$\\Gamma(t)$　会产生移动，位置与温度分布相关，这类问题称为Stefan问题．\n",
    "\n",
    "\n",
    "- **枝晶凝固(Dendritic Solidification):**  具有树枝状图案的晶体凝固．\n",
    "\n",
    "\n",
    "- **热容:**  热力学过程中，单位质量的物质温度每变化1K时所吸收或放出的热量称为比热容，简称热容。记为　$c^+$, $c^-$．\n",
    "\n",
    "\n",
    "- **热扩散系数:**  物体在加热或冷却过程中，各部分温度趋向一致能力的特征参数.$k^+$, 液体的热扩散系数; $k^-$, 固体的热扩散系数.\n",
    "\n",
    "\n",
    "- **各向异性:** 　晶体结构是组成晶体的基元在空间中周期性的规则排列,其排列的特征及原子间的相互作用一般随方向而异,从而导致晶体的物理性质也与方向有关,在度量时,物理性质随方向而变化,这种特性称为各向异性.\n",
    "\n",
    "\n",
    "- **区域:**   $\\Omega = \\Omega^+\\cup\\Omega^-$, 其中 $\\Omega^+$ 为液态区域,$\\Omega^-$ 为固体区域.\n",
    "\n",
    "\n",
    "- **温度分布:**   $T(x, t)$, $ T^-(x,t)=T(x,t)|_{\\Omega^-} $, $T^+(x,t) =T(x,t)|_{\\Omega^+}$.\n",
    "\n",
    "\n",
    "- **界面法向:**   $\\mathbf n$, 由 $\\Omega^-$ 指向 $\\Omega^+$.\n",
    "\n",
    "\n",
    "- **界面法向速度:**   $V_{\\mathbf n}$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 二　数学模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Stefan 问题的数学模型:**\n",
    "\n",
    "$$\n",
    "\\begin{aligned}\n",
    "　 c^- \\frac{\\partial T}{\\partial t}=&\\nabla \\cdot(k^-\\nabla T),x\\in \\Omega^-\\\\\n",
    "   c^+ \\frac{\\partial T}{\\partial t}=&\\nabla \\cdot(k^+\\nabla T),x\\in \\Omega^+\\\\\n",
    "\\end{aligned}\n",
    "$$\n",
    "\n",
    "界面 $\\Gamma$ 的移动速度与温度在界面上的法向间断有关:\n",
    "\n",
    "$$\n",
    "[kT_{\\mathbf n}]_\\Gamma = k^+T_{\\mathbf n}^+ - k^-T_{\\mathbf n}^- = -LV_{\\mathbf n}\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果是**固态的熔化问题**, 界面上的温度就是 \n",
    "\n",
    "$$\n",
    "T(x, t) = T_m \\quad x\\text{ on } \\Gamma\n",
    "$$ \n",
    "\n",
    "其中 $T_m$ 是固体的熔化温度."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果是**结晶问题**, 界面上的温度满足下面条件:\n",
    "\n",
    "$$\n",
    "T(x, t) = -\\epsilon_1\\kappa - \\epsilon_2V_{\\mathbf n}\\quad x \\text{ on } \\Gamma\n",
    "$$\n",
    "\n",
    "其中 $\\epsilon_1$ 是 surface tension coefficient; $ \\epsilon_2$ 是 molecular\n",
    "kinetic coefficient\n",
    "\n",
    "$$\n",
    "\\begin{aligned}\n",
    "\\epsilon_1(\\mathbf n) = \\bar{\\epsilon}_1(1 - A\\cos(k_A\\theta + \\theta_0))\\\\\n",
    "\\epsilon_2(\\mathbf n) = \\bar{\\epsilon}_2(1 - A\\cos(k_A\\theta + \\theta_0))\n",
    "\\end{aligned}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 三　水平集函数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\n",
    "\\Gamma(t) = \\{x\\in D:\\phi(x,t) = 0\\}\n",
    "$$\n",
    "\n",
    "初值　$\\phi$ 是一个符号距离函数，记:\n",
    "\n",
    "$$\n",
    "\\phi(x,0)=\n",
    "\\begin{cases}\n",
    "+d , & x \\in \\Omega^+\\\\\n",
    "0 , & x \\in \\Gamma\\\\\n",
    "-d , & x \\in \\Omega^-\n",
    "\\end{cases}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "给出法向速度　$V_n$ ，我们可以构造一个速度函数 $F$ ,则运动方程为:\n",
    "\n",
    "$$\n",
    "\\phi_t + F|\\nabla{\\phi}| = 0\n",
    "$$\n",
    "\n",
    "用 $ \\phi$ 定义外法向：\n",
    "\n",
    "$$\n",
    "\\mathbf{n} = \\nabla{\\phi}/|\\nabla{\\phi}|\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**曲率　$\\kappa$ :**\n",
    "\n",
    "$$\n",
    "\\kappa = \\nabla{\\mathbf n} = \\nabla(\\frac{\\nabla{\\phi}}{|\\nabla{\\phi}|})\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 四　数值例子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  4.1 可移动的平面界面"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一个稳定的平面界面：\n",
    "\n",
    "$$\n",
    "\\Omega(t) = \\{x\\in D:x<<V_nt\\}\n",
    "$$\n",
    "这里 $V_n$ 是一个常数．\n",
    "\n",
    "Stefan 问题的真解函数:\n",
    "$$\n",
    "T(x,t) = \n",
    "\\begin{cases}\n",
    "-1 + e^{-V_n(x - V_nt)}, & x>V_nt,\n",
    "0 , & x\\leq V_nt\n",
    "\\end{cases}\n",
    "$$\n",
    "\n",
    "方程中的界面由\n",
    "\n",
    "$$\n",
    "\\Gamma(t) = \\{x = V_nt,y = s\\},s\\in K\n",
    "$$\n",
    "参数化．"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们的方法应用于求真解与数值解的误差，求在 $L_1$ 范数下的误差，结果在下表所示:\n",
    "\n",
    "表I:可移动的平面界面带有时间步长和步长的加密网格的收敛\n",
    "\n",
    "|网格  |步长   |时间步长    　         |$$||T-T^n||_{L_1}$$      |收敛率|\n",
    "|------|:------|:--------              |:--------                |:-----|\n",
    "|80    |0.025  |$$1.00 \\times 10^{-4}$$|$$5.3657 \\times 10^{-7}$$|      |\n",
    "|160   |0.0125 |$$2.50 \\times 10^{-5}$$|$$1.3455 \\times 10^{-7}$$|1.9956|\n",
    "|320   |0.00625|$$6.25 \\times 10^{-6}$$|$$3.3664 \\times 10^{-8}$$|1.9988|\n",
    "\n",
    "注: $N=100,400,1600$ , $V_n=1$ , $final time = 0.01$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "表II:可移动的平面界面带有步长的加密网格的收敛\n",
    "\n",
    "|网格      |步长      |$$||T-T^n||_{L_1}$$         |收敛率　　| \n",
    "|-------   |:-------- |:--------                   |:-------- | \n",
    "|80        |0.025     |$$1.3281 \\times 10^{-3}$$   |          | \n",
    "|160       |0.0125    |$$2.6265 \\times 10^{-4}$$   |2.3382    | \n",
    "|320       |0.00625   |$$3.6651 \\times 10^{-5} $$  |2.8412    | \n",
    "|640       |0.003125  |$$3.7552 \\times 10^{-6} $$  |3.2887    |\n",
    "\n",
    "注: $N=400,V_n=1,dt=0.00001$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 不稳定的Mullins-Sekerka\n",
    "\n",
    "通过扰乱界面:\n",
    "\n",
    "$$\n",
    "x = V_nt + \\varepsilon e^{\\lambda t}\\sin(ky) \n",
    "$$\n",
    "\n",
    "可以得到一个扰乱温度的表达式.\n",
    "\n",
    "$$\n",
    "T(x,y,t) = T_0(x,y,t) + \\varepsilon e^{\\lambda t}\\sin(ky)\n",
    "\\begin{cases}\n",
    "f_1(k,V_n) , & x>V_nt\\\\\n",
    "f_2(k,V_n) , & x<V_nt\n",
    "\\end{cases}\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 结果:一个平面界面时间的小变化将增大它的任意性．\n",
    "\n",
    "\n",
    "- 网格：　　　$ 50 \\times 50$\n",
    "\n",
    "\n",
    "- 时间步长：　$ \\Delta t = 0.001$\n",
    "\n",
    "\n",
    "- 最后时间：　$ t = 1$\n",
    "\n",
    "\n",
    "- 温度：　　　$ T = 0, ~on ~the ~interface$\n",
    "\n",
    "\n",
    "- 在时间长   $ 0,0.1,0.2,\\dots,0.9,1$ 处显示出水平曲线．\n",
    "\n",
    "\n",
    "如图4所示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 增长的　Frank　球面\n",
    "\n",
    "对于　Stefan 问题的古典解被称为增长的　Frank 球面解．\n",
    "\n",
    "这里固体区域是一个半径为 $R = St^{\\frac{1}{2}}$ 的圆柱，且温度区域　$T(r,t)$\n",
    "由下式给出:\n",
    "\n",
    "$$\n",
    "T(r,t) = T(s) = \n",
    "\\begin{cases}\n",
    "T_{\\infty}(1-\\frac{F(s)}{F(S)}), & s>S,\n",
    "0, & s<S,\n",
    "\\end{cases}\n",
    "$$\n",
    "\n",
    "这里 $r = \\sqrt{x^2+y^2},s = r/t^{1/2}$ , $T_{\\infty}$ 是过冷度，\n",
    "$F(s) = E_1(\\frac{1}{4}s^2)$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用着Frank 球面的一些数值结果如表III所示:\n",
    "\n",
    "|网格               |步长 |时间步长 |$$||T-T^n||_{L_1} $$        |收敛率　| \n",
    "|-------            |:----|:--------|:--------                   |:-------| \n",
    "|$$80 \\times 80  $$ |0.2  |3000     |$$4.3709 \\times 10^{-2}$$   |        | \n",
    "|$$160 \\times 160$$ |0.1  |12000    |$$1.4331 \\times 10^{-2}$$   |1.608   | \n",
    "|$$320 \\times 320$$ |0.05 |48000    |$$3.7938 \\times 10^{-3}$$   |1.917   |\n",
    "\n",
    "注:$Final time = 1.12$ ,$T_{\\infty} = -0.5$ ,空间区域 $16 \\times 16$ ,\n",
    "\n",
    "边界条件:齐次 Neumann 边界条件．\n",
    "\n",
    "如图5所示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 震荡圆\n",
    "\n",
    "- 构造包含一个界面的Stefan问题的一个真解．\n",
    "\n",
    "\n",
    "- 例：网格：$40 \\times 40,80 \\times 80,160 \\times 160,320 \\times 320$\n",
    "\n",
    "\n",
    "- 时间步长： $\\Delta t = 0.002$\n",
    "\n",
    "\n",
    "- 在时间 $0.05,0.1,0.2,0.3,0.4,0.5$ 处显示结果．\n",
    "\n",
    "\n",
    "图6所示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cusp Formation\n",
    "\n",
    "对于在[17]中提出的自适应有限元方法，初始数据对于看数值结果如何是一个好的测试．\n",
    "\n",
    "\n",
    "- 网格： $100 \\times 100$\n",
    "\n",
    "\n",
    "- 步长： $h = 0.05$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.002$\n",
    "\n",
    "\n",
    "- 在 $0.02,0.22,0.4,0.62,0.82$ 处显示结果．\n",
    "\n",
    "\n",
    "如图7所示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 加密网格\n",
    "\n",
    "**初始界面形状:**\n",
    "\n",
    "$$\n",
    "x(s) = (R+P\\cos(8\\pi s))\\cos(2\\pi s)\n",
    "$$\n",
    "\n",
    "这里 $R = 0.1, P = 0.02$\n",
    "\n",
    "- 空间区域: $[-2,2] \\times [-2,2]$\n",
    "\n",
    "\n",
    "- 网格尺寸: $100 \\times 100,200 \\times 200,300 \\times 300,400 \\times 400$\n",
    "\n",
    "\n",
    "- 时间步长: $\\Delta t = 0.0005$\n",
    "\n",
    "\n",
    "- 表面张力系数: $\\epsilon_1 = 0.002$\n",
    "\n",
    "\n",
    "- 分子活跃系数: $\\epsilon_2 = 0.002$\n",
    "\n",
    "\n",
    "- 过冷度: $T_{\\infty} = -0.5$\n",
    "\n",
    "\n",
    "- 时间以 $0.04$ 的幅度增加，最终时间为 $0.8$.\n",
    "\n",
    "如图8所示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 拓扑改变\n",
    "\n",
    "例１: 图9没有表示出模型方程的真解，而是用水平集方法介绍一个数值计算．\n",
    "\n",
    "\n",
    "- 网格 $300 \\times 300$\n",
    "\n",
    "\n",
    "- 步长：$\\Delta x = 0.1$\n",
    "\n",
    "\n",
    "- 时间步长： $\\Delta t = 0.01$\n",
    "\n",
    "\n",
    "- 过冷度： $T_{\\infty} = -0.5$\n",
    "\n",
    "\n",
    "- 区域： $D = [-15,15]$\n",
    "\n",
    "\n",
    "- 表面张力系数: $\\epsilon_1 = 0.001$\n",
    "\n",
    "\n",
    "- 分子活跃系数: $\\epsilon_2 = 0.001$ \n",
    "\n",
    "\n",
    "- 时间以 $3$ 的幅度增加，最终时间为 $24$\n",
    "\n",
    "\n",
    "- 边界上：$T = T_{\\infty} = -1$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " 例２\n",
    "\n",
    "\n",
    "- 网格：$200 \\times 200$\n",
    "\n",
    "\n",
    "- 步长：$\\Delta x = 0.0005$\n",
    "\n",
    "\n",
    "- 空间区域: $[-1,1] \\times [-1,1]$\n",
    "\n",
    "\n",
    "- 潜热： $L = 1$\n",
    "\n",
    "\n",
    "- 时间：$t = 0,0.025,0.05,0.075,\\dots,0.175$\n",
    "\n",
    "\n",
    "- 步长：$\\Delta x = 0.1$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例3:　图11是由两个圆的演变\n",
    "\n",
    "\n",
    "- 网格：$200 \\times 200$\n",
    "\n",
    "\n",
    "- 空间区域: $[-2.5,2.5] \\times [-2.5,2.5]$\n",
    "\n",
    "\n",
    "- 潜热： $L = 0.075$\n",
    "\n",
    "\n",
    "- 时间：$t = 0.0,0.01,0.02,0.03,0.04,0.05,0.08,0.1,0.11$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0001$ \n",
    "\n",
    "\n",
    "- 表面张力系数: $\\epsilon_1 = 0.001$\n",
    "\n",
    "\n",
    "- 分子活跃系数: $\\epsilon_2 = 0.001$\n",
    "\n",
    "\n",
    "- 过冷度：$T_{\\infty} = -1$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例4:　图12是由四个晶体的演变\n",
    "\n",
    "\n",
    "- 网格：$100 \\times 100$\n",
    "\n",
    "\n",
    "- 空间区域: $[-0.5,0.5] \\times [-0.5,0.5]$\n",
    "\n",
    "\n",
    "- 潜热： $L = 0.5$\n",
    "\n",
    "\n",
    "- 时间：$t = 0.0,0.004,0.008,0.012,0.016,0.02,0.024,0.028,0.032$\n",
    "\n",
    "\n",
    "- 表面张力系数: $\\epsilon_1 = 0.001$\n",
    "\n",
    "\n",
    "- 分子活跃系数: $\\epsilon_2 = 0.001$\n",
    "\n",
    "\n",
    "- 过冷度：$T_{\\infty} = -1$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 表面张力系数的变化\n",
    "\n",
    "\n",
    "13上边的图说明了用水平集方法介绍数值解，在中间和下边的图说明了当各向同性表面张力系数的值增加时，网格会使各向异性增加．\n",
    "\n",
    "\n",
    "- 网格：$300 \\times 300$\n",
    "\n",
    "\n",
    "- 步长：$h = 0.01$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0005$\n",
    "\n",
    "\n",
    "- 过冷度：$T_{\\infty} = -0.5$\n",
    "\n",
    "\n",
    "- 时间以 $0.02$ 的幅度增加，最终时间为 $0.4$ , $N = 800$\n",
    "\n",
    "\n",
    "- 分子活跃系数：$\\epsilon_2 = 0$\n",
    "\n",
    "\n",
    "- 上边图：$T = 0,on~ \\Gamma$\n",
    "\n",
    "\n",
    "- 中间图：$T = -\\epsilon_1\\kappa,on \\Gamma$,且 $\\epsilon_1 = 0.0005$\n",
    "\n",
    "\n",
    "- 下边图：$T = -\\epsilon_1\\kappa,on \\Gamma$,且 $\\epsilon_1 = 0.0001$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 各向异性的结果\n",
    "\n",
    "\n",
    "在图14中通过增加各向异形得出曲率的表达式：\n",
    "\n",
    "$$\n",
    "\\epsilon_1(\\mathbf n) =\n",
    "\\bar{\\epsilon_1}(\\frac{8}{3}\\sin^4(\\frac{1}{2}m(\\theta-theta_0)))\n",
    "$$\n",
    "\n",
    "这里 $m = 4,\\theta_0 = \\frac{\\pi}{4}$ , $m$ 是模型数量，$\\theta_0$ 是相角．\n",
    "\n",
    "\n",
    "- 网格：$300 \\times 300$\n",
    "\n",
    "\n",
    "- 步长：$h = 0.01$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0005$\n",
    "\n",
    "\n",
    "- 过冷度：$T_{\\infty} = -0.5$\n",
    "\n",
    "\n",
    "- 时间以 $0.02$ 的幅度增加，最终时间为 $0.4$ , $N = 800$\n",
    "\n",
    "\n",
    "- 分子活跃系数：\n",
    "\n",
    "$$\n",
    "\\epsilon_2 = 0 \\\\\n",
    "T = -\\epsilon_1(\\mathbf n)\\kappa\\\\\n",
    "\\bar{\\epsilon_1} = 0.001\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 各向异性的收敛\n",
    "\n",
    "\n",
    "在表IV中，可以知道四个网格尺寸和 $\\bar{\\epsilon_1}$ 的三个值；\n",
    "在表V中，可以知道各向异性对应半径的值．\n",
    "\n",
    "例1:图15是由跟表IV和V相同的初始条件产生的．"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "表IV\n",
    "\n",
    "|网格               |$$\\epsilon_1 = 0.0005$$|$$\\epsilon_1 = 0.001$$|$$\\epsilon_1 = 0.002$$| \n",
    "|-------            |:--------              |:--------             |:--------         |\n",
    "|$$75 \\times 75$$   |37.17                  |38.94                 |35.62             |\n",
    "|$$100 \\times 100$$ |37.17                  |42.48                 |38.05             |\n",
    "|$$125 \\times 125 $$|50.44                  |49.56                 |43.36             |\n",
    "|$$150 \\times 150$$ |53.10                  |51.33                 |44.25             |\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "表V\n",
    "\n",
    "|网格              |$$\\epsilon_1 = 0.0005$$ |$$\\epsilon_1 = 0.001$$  |$$\\epsilon_1 = 0.002$$ | \n",
    "|-------           |:--------               |:--------               |:--------              |\n",
    "|$$75 \\times 75$$  |$$3.197 \\times 10^{-2}$$|$$3.685 \\times 10^{-2}$$|$$3.147\\times 10^{-2}$$|\n",
    "|$$100 \\times 100$$|$$1.497 \\times 10^{-2}$$|$$2.771 \\times 10^{-2}$$|$$2.080\\times 10^{-2}$$|\n",
    "|$$125 \\times 125$$|$$2.103 \\times 10^{-2}$$|$$1.886 \\times 10^{-2}$$|$$1.503\\times 10^{-2}$$|\n",
    "|$$150 \\times 150$$|$$1.605 \\times 10^{-2}$$|$$1.446 \\times 10^{-2}$$|$$1.302\\times 10^{-2}$$|\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 分子活跃系数：$\\epsilon_2 = 0$\n",
    "\n",
    "\n",
    "- 过冷度：　$T_{\\infty} = -0.5$\n",
    "\n",
    "\n",
    "- 区域: $[-0.5,0.5]$\n",
    "\n",
    "\n",
    "- 时间以 $0.01$ 的幅度增加，最终时间为 $0.05$ , $\\bar{\\epsilon_1} = 0.001$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例2: 图16是凝固的潜热变化的影响：\n",
    "\n",
    "\n",
    "- 网格：$100 \\times 100$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0005$\n",
    "\n",
    "\n",
    "- 过冷度：　$T_{\\infty} = -0.5$ \n",
    "\n",
    "\n",
    "- 步长：$h = 0.01$\n",
    "\n",
    "\n",
    "- 表面张力系数: $\\epsilon_1 = 0.001$\n",
    "\n",
    "\n",
    "- 分子活跃系数: $\\epsilon_2 = 0.001$\n",
    "\n",
    "\n",
    "- 区域: $[-0.5,0.5]　\\times [-0.5,0.5]$\n",
    "\n",
    "\n",
    "- 时间以 $0.005$ 的幅度增加，最终时间为 $0.05$\n",
    "\n",
    "\n",
    "- 潜热：$L = 1.0,0.75,0.5,0.25$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 网格方向的影响\n",
    "\n",
    "例１：带有各向同性表面张力的网格方向的影响,$\\epsilon_1 = 0.001$ ,网格方向的影响最小．图17是用相同的初始形状且旋转45度和35度.\n",
    "\n",
    "\n",
    "- 网格： $200 \\times 200$\n",
    "\n",
    "\n",
    "- 步长： $h = 0.01$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0005$\n",
    "\n",
    "\n",
    "- 过冷度： $T_{infty} = -0.5$ ,$N = 400$\n",
    "\n",
    "\n",
    "- 表面张力系数：　$\\epsilon_1 = 0.001$\n",
    "\n",
    "\n",
    "- 分子活跃系数： $\\epsilon_2 = 0$\n",
    "\n",
    "\n",
    "- 时间以 $0.025$ 的幅度增加，最终时间为 $0.2$\n",
    "\n",
    "\n",
    "- 区域：$[-1,1] \\times [-1,1]$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例２：带有各向异性的网格方向的影响\n",
    "\n",
    "图18是相角分别为 $\\theta_0 = 0$ 和 $\\theta_0 = \\frac{\\pi}{4}$\n",
    "\n",
    "\n",
    "- 网格： $200 \\times 200$\n",
    "\n",
    "\n",
    "- 步长： $h = 0.01$\n",
    "\n",
    "\n",
    "- 时间步长：$\\Delta t = 0.0005$ ,\n",
    "\n",
    "\n",
    "- $\\bar{\\epsilon_1} = 0.001$ ,$\\bar{\\epsilon_2} = 0.001$\n",
    "\n",
    "\n",
    "- 时间以 $0.01$ 的幅度增加，最终时间为 $0.04$\n",
    "\n",
    "\n",
    "- 区域：$[-1,1] \\times [-1,1]$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 变分形式"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "温度场 $T(x, t) \\in H^1(\\Omega)$, 模型问题的变分形式如下:\n",
    "\n",
    "$$\n",
    "(c^-\\frac{\\partial T^-}{\\partial t}, v)_{\\Omega^-} + (k^-\\nabla T^-, \\nabla v)_{\\Omega^-}= (\\frac{\\partial T^-}{\\partial\\mathbf n}, v)_{\\Gamma}\n",
    "$$\n",
    "\n",
    "$$\n",
    "(c^+\\frac{\\partial T^+}{\\partial t}, v)_{\\Omega^+} + (k^+\\nabla T^+, \\nabla v)_{\\Omega^+}= -(\\frac{\\partial T^+}{\\partial\\mathbf n}, v)_{\\Gamma} + (\\frac{\\partial T^+}{\\partial\\mathbf n}, v)_{\\partial\\Omega}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "上面两式相加, 可得\n",
    "\n",
    "$$\n",
    "(c\\frac{\\partial T}{\\partial t}, v)_{\\Omega} + (k\\nabla T, \\nabla v)_{\\Omega} = - ([kT]_{\\mathbf n}, v)_\\Gamma +  (\\frac{\\partial T}{\\partial\\mathbf n}, v)_{\\partial\\Omega}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 线性有限元离散"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用线性有限元求解上上述问题, $v_h \\in V_0(\\Omega)$ ."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "设 $T^n_h$ 是第 $n$ 个时间步的解, $T^{n+1}_h$ 是 第 $n+1$ 个时间步的解. 如果用显式方法:\n",
    "\n",
    "$$\n",
    "(c\\frac{T^{n+1}_h - T^n_h}{\\Delta t}, v_h)_{\\Omega} + (k\\nabla T^n_h, \\nabla v_h)_{\\Omega} = - ([kT^n]_{\\mathbf n}, v)_\\Gamma\n",
    "$$\n",
    "\n",
    "$$\n",
    "(cT^{n+1}_h, v_h)_{\\Omega}  =(cT^n_h, v_h) - \\Delta t(k\\nabla T^n_h, \\nabla v_h)_{\\Omega} - ([kT^n]_{\\mathbf n}, v)_\\Gamma\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果用隐式的方式求解:\n",
    "$$\n",
    "(c\\frac{T^{n+1}_h - T^n_h}{\\Delta t}, v_h)_{\\Omega} + (k\\nabla T^{n+1}_h, \\nabla v_h)_{\\Omega} = - ([kT^n]_{\\mathbf n}, v)_\\Gamma\n",
    "$$\n",
    "\n",
    "$$\n",
    "(cT^{n+1}_h, v_h)_{\\Omega} + \\Delta t (k\\nabla T^{n+1}_h, \\nabla v_h)_{\\Omega} = (cT^n_h, v_h) - \\Delta t ([kT^n]_{\\mathbf n}, v)_\\Gamma.\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 算法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. 初始化温度场 $T(x,0)$ 和符号距离函数 $\\phi(x, 0)$.\n",
    "1. 计算 $\\Omega$ 上的速度场 $\\mathbf F(x, t_n)$, 它是 $-[kT]_{\\mathbf n}$ 从 $\\Gamma$ 到整个区域 $\\Omega$ 的扩展.\n",
    "1. 利用方程 $$\\phi_t + \\mathbf F |\\nabla \\phi | = 0$$ 更新 $\\phi(x,t_{n+1})$.\n",
    "1. 通过求解方程 $$ \\phi_t = S(\\phi_0)(1 - |\\nabla\\phi|)$$ 重新初始化 $\\phi(x, t_{n+1})$, 使它成为一个距离函数, 其中 $\\phi(x, 0) = \\phi(x, t_{n+1})$.\n",
    "1. 更新温度场 $T(x, t_{n+1})$ "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 0
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
